package cn.tedu.controller;


import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.tedu.entity.News;
import cn.tedu.service.NewsService;
import cn.tedu.service.impl.NewsServiceImpl;
/**
 * 最新基地动态二级页面
 * @author waqwb
 *
 */
public class NewsServlet extends HttpServlet {
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		System.out.println("NewsServlet!!!");
		response.setContentType("text/html;charset=utf-8");
		/**
		 * 新闻
		 */
		NewsService newsService = new NewsServiceImpl();
		int id  = Integer.parseInt(request.getParameter("id"));
		System.out.println(id);
		List<News> newsList = newsService.getNewsById(id);
		request.setAttribute("newsList",newsList );
		request.getRequestDispatcher("article.jsp").forward(request, response);
	}
}
